<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AddDelegates.aspx.cs" Inherits="PHSRAG.Insight21.COI.AddDelegates" %>
<%@ Register TagPrefix="cc2" Namespace="PHSRAG.WebControls" Assembly="PHSRAG.WebControls" %>
<%@ Register TagPrefix="cc1" Namespace="PHSRAG.Insight21.InsightWebControls" Assembly="PHSRAG.Insight21.InsightWebControls" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">

    <title>COI - Add Delegates</title>
    <link href="../Insight21.css" type="text/css" rel="stylesheet" />
    <script language="javascript" type="text/javascript">
		function Search(searchId)
		{
			if (window.event.keyCode == 13)
			{
				searchId.click()
				window.event.returnValue = false;
			}
		}
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <table class="Container" width="100%">
            <tr>
                <td>
                    <asp:Panel ID="headerSection" Visible = "false" runat="server">
                        <table class="Header" width="100%">
                            <tr><td><cc1:Header ID="header" runat="server" CssClass="Header"></cc1:Header></td></tr>
                            <tr style="display: none"><td><cc1:CoISubNavigation ID="coiSubNavigation" runat="server"></cc1:CoISubNavigation></td></tr>
                            <tr><td><cc1:COIAdminSubNavigation ID="coiAdminSubNavigation" runat="server"></cc1:COIAdminSubNavigation></td></tr>
                            <tr><td><cc2:BreadCrumb ID="breadCrumb" runat="server" HighlightCurrentPage="true"></cc2:BreadCrumb></td>
                            </tr>
                        </table>                       
                    </asp:Panel>                    
                    <table class="FormsManagement" cellspacing="10" cellpadding="10" width="100%" bgcolor="#ffffff">
                        <tr><td class = "OrangeLabel">Search & Add Delegates</td></tr>
                        <tr>                            
                            <td>
                                <cc2:ExpandingPanel ID="addDelegatesPanel" runat="server" ExpansionToggler="addDelegateUserToggler">
                                    <StaticTemplate>
                                        <table class="Search">
                                            <tr>
                                                <td>
                                                    <table id="expandedSearch" runat="server" width="100%">
                                                        <tr>
                                                            <td>
                                                                <table width="100%">
                                                                    <tr>
                                                                        <td>
                                                                            <cc1:COISearch ID="coISearch"  ViewOptionVisible="false" ViewExternalUsersVisible = "false"  ShowHierarchyType="false" runat="server"></cc1:COISearch>
                                                                        </td>
                                                                        <td>
                                                                            <cc1:CommonSearch ID="commonSearch" HideAllCommonControls="true" OnSearch="OnSearch"
                                                                                OnClearSelection="OnClearSelection" runat="server" Module="COI" EmbeddedSearchControl="true"
                                                                                ExtendedSearchControl="CoISearch"></cc1:CommonSearch>
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </td>
                                                        </tr>
                                                        <tr style="display: none">
                                                            <td class="PanelSeparator">
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <cc2:ExpansionToggler ID="addDelegateUserToggler" runat="Server" ExpandedImage="~/Images/Arrow_DN.gif"
                                                                    CollapsedImage="~/Images/Arrow_RT.gif" ExpandedLinkCaption="Hide Instructions"
                                                                    CollapsedLinkCaption="Show Instructions"></cc2:ExpansionToggler>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                        </table>
                                    </StaticTemplate>
                                    <DynamicTemplate>
                                        <table class="SearchDynamic">
                                            <tr>
                                                <td>
                                                    &nbsp;</td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    &nbsp;&nbsp;Use this page to search and add delegate(s) for a supervisor.Also 
                                                    To add delegate(s) to a supervisor, follow the instructions mentioned below.
                                                    <ol>
                                                        <li>Enter the known parameters in one/more of the above textbox. </li>
                                                        <li>Click Search. </li>
                                                        <li>Add the users by selecting the left most checkbox in the result set returned and
                                                            click "add to list". </li>
                                                        <li>Repeat step 3 to add more than one delegate.</li>
                                                        <li>Select the users from the  selected list and click "Add Delegates".</li>
                                                    </ol>
                                                </td>
                                            </tr>
                                        </table>
                                    </DynamicTemplate>
                                </cc2:ExpandingPanel>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <cc1:SearchCriteriaDisplay ID="searchCriteriaDisplay" runat="server"></cc1:SearchCriteriaDisplay>
                            </td>
                        </tr>
                    </table>
                    <table width="100%" align="center" cellspacing="0">
                        <tr>
                            <td>
                                <table width="100%">
                                    <tr><td><cc2:PostbackGuard ID="postbackGuard" runat="server"></cc2:PostbackGuard></td></tr>                                
                                    <tr><td><cc2:Annunciator ID="annunciator" runat="server"></cc2:Annunciator></td></tr>
                                    <tr><td><cc2:SetFocus ID="setFocus" runat="server" FocusControl="lastName"></cc2:SetFocus></td></tr>
                                    <tr><td><cc2:ActivityIndicator ID="activityIndicator" runat="server"></cc2:ActivityIndicator></td></tr>
                                </table>                               
                                <asp:Panel ID="gridContainer" Visible="False" runat="server">
                                    <table width="100%" cellspacing="0">
                                        <tr>
                                            <td>
                                                <table class="DataTitle" width="100%">
                                                    <tr><td>&nbsp;Search Results</td></tr>
                                                </table>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <cc2:Pager ID="topPager" runat="server"></cc2:Pager>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <asp:DataGrid CellSpacing="0" ID="searchResults" runat="server" CssClass="DataGrid"
                                                    AllowCustomPaging="true" AutoGenerateColumns="False" Width="100%" AllowSorting="true"
                                                    AllowPaging="true">
                                                    <FooterStyle CssClass="DataGridHeader"></FooterStyle>
                                                    <AlternatingItemStyle CssClass="DataGridAlternatingItem"></AlternatingItemStyle>
                                                    <ItemStyle CssClass="DataGridItem"></ItemStyle>
                                                    <HeaderStyle CssClass="DataGridHeader"></HeaderStyle>
                                                    <Columns>
                                                        <asp:BoundColumn SortExpression="LastName" HeaderText="Last Name" DataField="LastName"
                                                            ReadOnly="True"></asp:BoundColumn>
                                                        <asp:BoundColumn SortExpression="FirstName" HeaderText="First Name" DataField="FirstName"
                                                            ReadOnly="True"></asp:BoundColumn>
                                                        <asp:BoundColumn SortExpression="Username" HeaderText="Username" DataField="Username"
                                                            ReadOnly="True"></asp:BoundColumn>
                                                        <asp:BoundColumn SortExpression="Organization" HeaderText="Institution > Department > Unit"
                                                            DataField="Organization" ReadOnly="True"></asp:BoundColumn>
                                                        <asp:TemplateColumn HeaderText="Select" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
                                                            <ItemTemplate>
                                                                <asp:CheckBox runat="server" ID="selectUser" AutoPostBack="False"></asp:CheckBox>
                                                            </ItemTemplate>
                                                        </asp:TemplateColumn>
                                                    </Columns>
                                                    <PagerStyle Visible="False"></PagerStyle>
                                                </asp:DataGrid></td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <cc2:Pager ID="bottomPager" runat="server"></cc2:Pager>
                                            </td>
                                        </tr>
                                    </table>
                                    <table width="100%">
                                        <tr align="right">
                                            <td>
                                                <asp:ImageButton ID="addtoList" runat="server" ImageUrl="../Images/b_add_to_list.gif">
                                                </asp:ImageButton>&nbsp;&nbsp;&nbsp;
                                            </td>
                                        </tr>
                                    </table>
                                </asp:Panel>
                                <br />
                                <asp:Panel ID="selectedUsersContainer" Visible="False" runat="server">
                                    <table width="100%" cellspacing="0">
                                        <tbody>
                                            <tr>
                                                <td>
                                                    <table class="DataTitle" width="100%" cellspacing="0">
                                                        <tr>
                                                            <td>
                                                                &nbsp;Selected User(s)</td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </asp:Panel>
                            </td>
                            <asp:DataGrid ID="selectedUsers" runat="server" CssClass="DataGrid" AllowPaging="true"
                                AllowSorting="False" Width="100%" AutoGenerateColumns="False" AllowCustomPaging="true">
                                <AlternatingItemStyle CssClass="DataGridAlternatingItem"></AlternatingItemStyle>
                                <ItemStyle CssClass="DataGridItem"></ItemStyle>
                                <HeaderStyle CssClass="DataGridHeader"></HeaderStyle>
                                <Columns>
                                    <asp:BoundColumn SortExpression="LastName" HeaderText="Last Name" DataField="LastName"
                                        ReadOnly="True"></asp:BoundColumn>
                                    <asp:BoundColumn SortExpression="FirstName" HeaderText="First Name" DataField="FirstName"
                                        ReadOnly="True"></asp:BoundColumn>
                                    <asp:BoundColumn SortExpression="Username" HeaderText="Username" DataField="Username"
                                        ReadOnly="True"></asp:BoundColumn>
                                    <asp:BoundColumn SortExpression="Organization" HeaderText="Institution > Department > Unit"
                                        DataField="Organization" ReadOnly="True"></asp:BoundColumn>
                                    <asp:TemplateColumn HeaderText="Select" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
                                        <ItemTemplate>
                                            <asp:CheckBox runat="server" ID="addAsDelegate" AutoPostBack="False"></asp:CheckBox>
                                        </ItemTemplate>
                                    </asp:TemplateColumn>
                                </Columns>
                                <PagerStyle Visible="False"></PagerStyle>
                            </asp:DataGrid>
                        </tr>
                        <tr>
                            <td>
                                <table width="100%">
                                    <tr align="right">
                                        <td>
                                            <asp:ImageButton ID="cancel" runat="server" ImageUrl="../Images/b_cancel.gif"></asp:ImageButton>&nbsp;
                                            <asp:ImageButton ID="save" runat="server" Visible="False" ImageUrl="../Images/b_add_delegate.gif">
                                            </asp:ImageButton>&nbsp;
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                    <br />
                </td>
            </tr>
        </table>
    </form>
</body>
</html>
